package demo5;

/**
 * @Author 12629
 * @Description：
 */
public class TestDemo {
    public static void walk(IRunable runable) {
        runable.run();
    }
    public static void swim(ISwimmable iSwimmable) {
        iSwimmable.swim();
    }
    public static void fly(IFlyable iFlyable) {
        iFlyable.fly();
    }
    public static void main(String[] args) {
        Bird bird = new Bird("小飞",3);
        Dog dog = new Dog("旺财",13);
        Duck duck = new Duck("勺颠颠",5);
        Robot robot = new Robot();
        walk(duck);
        walk(dog);
        walk(robot);
        System.out.println("=====");
        swim(duck);
        swim(dog);
        System.out.println("====");
        fly(duck);
        fly(bird);
    }

    public static void eatFun(Animal animal) {
        animal.eat();
    }



    public static void main1(String[] args) {
        Bird bird = new Bird("小飞",3);

        Dog dog = new Dog("旺财",13);

        eatFun(bird);

        eatFun(dog);
    }
}
